#include "Sort.h"

void TestInsertSort()
{
    int arr[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    InsertSort(arr, sizeof(arr) / sizeof(arr[0]));
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

void TesShellpSort()
{
    int arr[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    ShellSort(arr, sizeof(arr) / sizeof(arr[0]));
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

void TestBubbleSort()
{
    int arr[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    BubbleSort(arr, sizeof(arr) / sizeof(arr[0]));
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

void TestQuickSort()
{
    int arr[] = { 6, 1, 2, 7, 9, 3, 4, 5, 10, 8 };
    QuickSort3(arr, 0, sizeof(arr) / sizeof(arr[0]) - 1);
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

void TestSelectSort()
{
    int arr[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    SelectSort(arr, sizeof(arr) / sizeof(arr[0]));
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

void TestHeapSort()
{

    int arr[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    HeapSort(arr, sizeof(arr) / sizeof(arr[0]));
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

void TestMergeSort()
{
    int arr[] = { 10, 6, 7, 1, 3, 9, 4, 2, 8, 5 };
    //MergeSort(arr, sizeof(arr) / sizeof(arr[0]));

    //非递归
    MergeSortNonR(arr, sizeof(arr) / sizeof(arr[0]));
    PrintArray(arr, sizeof(arr) / sizeof(arr[0]));
}

int main()
{
    printf("插入排序：");
    TestInsertSort();

    printf("希尔排序：");
    TesShellpSort();

    printf("冒泡排序：");
    TestBubbleSort();

    printf("快速排序：");
    TestQuickSort();

    printf("选择排序：");
    TestSelectSort();

    printf("堆排序：");
    TestHeapSort();

    printf("归并排序：");
    TestMergeSort();

    return 0;
}